#ifndef INIT_H
#define INIT_H
#include <ntddk.h>
#include <ntdddisk.h>
//bp Soldatov!DriverEntry
//bp Soldatov!FileDiskDeviceControl
//bp Soldatov!ReadWrite_IRPhandler
//bp Soldatov!FileDiskThread
//bp Soldatov!FileDiskCreateDevice


//DriverObject  0x86396458 struct _DRIVER_OBJECT *
//DeviceObject 0x84c3b030 struct _DEVICE_OBJECT *  FDO


#define FILE_DEVICE_FILE_DISK       0x8000
#define IOCTL_FILE_DISK_MOUNT   CTL_CODE(FILE_DEVICE_FILE_DISK, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_FILE_DISK_UNMOUNT  CTL_CODE(FILE_DEVICE_FILE_DISK, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_FILE_DISK_QUERY_FILE  CTL_CODE(FILE_DEVICE_FILE_DISK, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS)
#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)

typedef struct _ALGORITM_INF {
	unsigned char KeyLength;
	unsigned char Key[64];
} ALGORITM_INF, *PALGORITM_INF;


typedef struct _DISK_INFO {
	UNICODE_STRING FilePath;     // No. of root directory entries
	UNICODE_STRING DriveLetter; // Drive letter to be used
	DISK_GEOMETRY_EX DiskGeometryEx;
	ALGORITM_INF AlgoritmInf;
} DISK_INFO, *PDISK_INFO;

typedef struct _DEVICE_EXTENSION {
	PDEVICE_OBJECT      FunctionDeviceObject;               // Back pointer to device object
	DISK_INFO           DiskInfo;                // Disk parameters from the registry
	UNICODE_STRING      device_name;               // Dos symbolic name; Drive letter
	HANDLE				file_handle;
	BOOLEAN                     media_in_device;
	LIST_ENTRY                  list_head;
	KSPIN_LOCK                  list_lock;
	KEVENT                      request_event;
	PVOID                       thread_pointer;
	BOOLEAN                     terminate_thread;
	union {
		PARTITION_INFORMATION_MBR Mbr;
		PARTITION_INFORMATION_GPT Gpt;
	};

} DEVICE_EXTENSION, *PDEVICE_EXTENSION;

typedef struct _FUNC_DEV_OBJ
{
	UNICODE_STRING      device_name, symbolic_link;
}FUNC_DEV_OBJ, *PFUNC_DEV_OBJ;

#endif